package com.example.springbootactuator.endpoint;

import com.example.springbootactuator.service.StatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 自定义端点
 * @author ljw
 * @date 2022/10/12 7:32
 */
@Component
@Endpoint(id="mypoint")
public class StatusEndPoint {

    @Autowired
    private StatusService statusService;

    @ReadOperation
    public Map<String, String> getStatus() {
        Map<String, String> map = new HashMap<>();
        map.put("satus", statusService.getStatus());
       return map;
    }
}
